<%--
  Created by IntelliJ IDEA.
  User: zzz
  Date: 2019/11/2
  Time: 18:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<html>
<head>
    <title>admininformation</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css"  media="all">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/uploadPreview.min.js"></script>
</head>
<body>
<form class="layui-form" action="${pageContext.request.contextPath}/UpdateAdminServlet.action" method="post" enctype="multipart/form-data">
    <input type="hidden" name="aid" value="${requestScope.admin.aid}">

    <div class="layui-form-item" style="margin-top:30px; width: 300px;">
        <label class="layui-form-label">管理员昵称:</label>
        <div class="layui-input-block">
            <input type="text" name="aname" lay-verify="title" autocomplete="off" placeholder="请输入昵称" class="layui-input" value="${requestScope.admin.aname}">
        </div>
    </div>

    <div class="layui-form-item" style="width: 300px;">
        <label class="layui-form-label">密码:</label>
        <div class="layui-input-block">
            <input type="text" name="apass" lay-verify="title" autocomplete="off" placeholder="请输入密码" class="layui-input" value="${requestScope.admin.apass}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">性别：</label>
        <div class="layui-input-block">
            <input type="radio" name="asex" value="男" title="男" checked="checked">
            <input type="radio" name="asex" value="女" title="女">
        </div>
    </div>
    <div class="layui-form-item" style="width: 300px;">
        <label class="layui-form-label">手机号码:</label>
        <div class="layui-input-block">
            <input type="text" name="aphone" lay-verify="title" autocomplete="off" placeholder="请输入手机号码" class="layui-input" value="${requestScope.admin.aphone}">
        </div>
    </div>

    <div class="layui-form-item" style="width: 300px;">
        <label class="layui-form-label">email:</label>
        <div class="layui-input-block">
            <input type="text" name="aemail" lay-verify="title" autocomplete="off" placeholder="请输入邮箱" class="layui-input" value="${requestScope.admin.aemail}">
        </div>
    </div>

    <div class="layui-inline">
        <label class="layui-form-label">生日:</label>
        <div class="layui-input-inline">
            <input type="text" name="birthday" id="birthday" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="${requestScope.admin.birthday}">
        </div>
    </div>


    <div class="layui-upload" style="margin-top: 20px;">
        <img id="ImgPr" style="width: 120px; height: 120px;" src="${pageContext.request.contextPath}/${requestScope.admin.aphoto}" />
        <input type="hidden" name="aphoto" value="${requestScope.admin.aphoto}">
        <label class="layui-form-label" for="face">头像:</label>
        <div class="layui-input-block">
            <input type="file" id="face" name="face">
        </div>
    </div>



    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>
</body>
</html>
<script src="${pageContext.request.contextPath}/layui/layui.js" charset="utf-8"></script>
<script>
    $("#face").uploadPreview({ Img: "ImgPr", Width: 220, Height: 220 });
    layui.use(['form', 'layedit', 'laydate'], function(){
         var $ = layui.jquery;
         var form = layui.form;
         var layer = layui.layer;
         var layedit = layui.layedit;
         var laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#birthday'
        });
        $("input:radio[value='${requestScope.admin.asex}']").prop("checked",true);
        form.render('radio');
    });

    $(function () {
      if($("#ImgPr").attr("src")=="${pageContext.request.contextPath}/"){
          $("#ImgPr").attr("src","${pageContext.request.contextPath}/img/2.jpg");
      }


    });
</script>